<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld" %>
<%@ taglib uri="/WEB-INF/tld/jmesa.tld" prefix="jmesa" %> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><strong>帖子信息</strong></title>
<link href="/estate/css/css.css" rel="stylesheet" type="text/css">
<script src="/estate/js/meizzDate.js"></script>
<script type="text/javascript" src="/estate/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/estate/js/jquery-1.2.2.pack.js"></script>
    <script type="text/javascript" src="/estate/js/jquery-1.3.min.js"></script> 
    <script type="text/javascript" src="/estate/js/jquery.jmesa.js"></script>
    <script type="text/javascript" src="/estate/js/jmesa.js"></script>              
    <link rel="stylesheet" type="text/css" href="/estate/css/jmesa.css"></link>
<script type="text/javascript">
	function updateAnnouncement(form){
		form.action="/estate/admin/announcementAction.action?method=modify";
   		form.submit();
	}
	function postAnnouncement(form){
		form.action="/estate/admin/announcementAction.action?method=post&state=2";
   		form.submit();
	}
	function showComment(){
		var comment = document.getElementById("comment");
		var replyId = document.getElementById("replyId");
		var forumId = document.getElementById("forumId");
		var id = document.getElementById("id");
		
		var commentId = document.getElementById("commentId");
		if(commentId == null || commentId==""){
			replyId.value="0";
		}else{
			replyId.value=commentId.value;
		}
		forumId.value=id.value;
		alert(forumId.value);
		if(comment.style.display=="none"){
			var commentTitle = document.getElementById("commentTitle");
			commentTitle.value="回复楼主：";
			
			comment.style.display="block";
			window.location = "#commentDiv";
		}else{
			comment.style.display="none";
			window.location = "#";
		}
		
	}
	function comment(form){
		form.action="/estate/admin/commentAction.action?method=add";
   		form.submit();
	}
	function mouseOver(e){
		e.preventDefault();
	}
</script>
<style type="text/css">
    .highlight{
	}
	#highlight{
	}
</style>
</head>
<body>
<form name="form1" id="form1" method="post" action="">
<table border="0" cellpadding="0" cellspacing="0" style="background-image:url(/estate/images/gtbg.gif) " width="100%">
    <tr>
      <td width="50%" height="82" rowspan="2"><img src="/estate/images/guide_01.gif"></td>
      <td width="50%" style="background-image:url(/estate/images/guide_02.gif);color:#cc1212; font-size:16px; font-weight:bold; text-align:right; padding-right:50px; letter-spacing:1px; " height="39"><strong>业务论坛</strong></td>
    </tr>
     <tr><td width="50%" style="background-image:url(/estate/images/guide_03.gif); height:43px;" align="center" valign="middle">
	  <table width="50%" border="0" cellspacing="0" cellpadding="0">
        <tr align="center">
          <td><input name="Submit1" type="button" onFocus="this.blur();" class="button2" value="发表文章" > </td>
          <td><input type="button" name="Submit2" onFocus="this.blur();" value="回复文章" class="button2" onclick="showComment()"> </td>
          <c:if test="${forum.postUser.id eq sessionScope.sessionUser.id}">
    		<td><input type="button" name="Submit2" onFocus="this.blur();" value="修改公告内容" class="button2" onclick="updateAnnouncement(form1)"> </td>
    	</c:if>
    	<c:if test="${forum.state eq '未发布'}">
    		<td><input type="button" name="Submit2" onFocus="this.blur();" value="发布公告" class="button2" onclick="postAnnouncement(form1)"> </td>
    	</c:if>
        </tr>
      </table></td>
    </tr>
</table><br>
<table width="80%" align="center" border="0" cellspacing="0" cellpadding="0" class="main">
	<input type="hidden" name="id" id="id" value="${fda.forum.id }"/>
  <tr align="center">
    <td colspan="2" class="tableTitle" style="text-align:left;vertical-align:super;">&nbsp;标题：${forum.title }</td>
  </tr>
  
  <tr>
 	<td rowspan="2" width="140"  style="height:170px;" align="right" class="two">
 		<div align="center">
 			<br/>
 			<span>${fda.forum.postUser.name }</span><br>
 			<img src="/estate/images/headphoto.jpg"/><br>
 		</div>
	</td>
   <td colspan="1" align="left" class="two"  style="height:20px;">发表于：${fda.forum.postDate }&nbsp;&nbsp;阅读数：${forum.readNum }&nbsp;&nbsp;回复数：${forum.commentNum }&nbsp;&nbsp;&nbsp;&nbsp;楼主</td>
  </tr>
  <tr>
    <td colspan="1" align="left" class="two" style="height:100px;vertical-align: top;">
    	<div align="left">
 			<span style="font-weight: bold;">${fda.forum.title }:</span><br>
 			<span>${fda.forum.content }</span><br>
 		</div>
	</td>
  </tr>
  <tr>
    <td width="100" align="center" class="two">${fda.forum.postDate }</td>
    <td class="two" align="right">&nbsp;<a href="#"><img src="/estate/images/p_up.gif"/></a></td>
  </tr>
 
</table><br>
</form>
<!-- 帖子结束 -->

<form  id="form2"  name="form2" action="" method="post">
<div align="center" >
	<div class="main" align="center" style="width:1000px;height:400px;">
      <jmesa:struts2TableModel items="${fda.commentList}" id="comment_table"  var="bean" stateAttr="restore" toolbar="com.estate.utils.JmesaForumToolBar" >
          <jmesa:htmlTable width="90%" style="text-align:center;" caption="<div style='height:20px;text-align:center;'>所有评论</div>">
              <jmesa:htmlRow uniqueProperty="id">
              	  <jmesa:htmlColumn width="100%" property="" sortable="false" title=""  editable="false" filterable="false">
              	  <div>
              	  <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" style="border-left: 1px solid #508fb6;border-top: 1px solid #508fb6;">
						<input type="hidden" name="id" id="id" value="${bean.id }"/>
					  <tr align="center">
					    <td colspan="2" class="tableTitle" style="text-align:left;vertical-align:super;padding: 0px; border:  1px solid #508fb6;">&nbsp;标题：</td>
					  </tr>
					  <tr style="border:0px">
					 	<td rowspan="2" width="1000px"  class="two" align="left" style="padding: 0px; border: 0px;">
					 		
					 		<div style="height:170px;width:120px;float:left;">
									<div style="height:140px;width:130px;float:top;border: 1px solid #508fb6;border-right:none;border-left:none;">
										<div align="center">
								 			<br/>
								 			<span>${bean.commentUser.name }</span><br>
								 			<img src="/estate/images/headphoto.jpg"/><br>
								 		</div>
									</div>
									<div style="height:25px;width:130px;float:top;border: 1px solid #508fb6;border-top:none;border-right:none;border-left:none;"></div>
							</div>
							<div style="height:170px;width:759px;float:left; border: 0px;">
									<div style="height:20px;width:757px;float:top;border: 1px solid #508fb6;">
										发表于：${bean.commentDate }
									</div>
									<div style="height:125px;width:757px;float:top;border: 1px solid #508fb6;border-top:none;">
										<div align="left">
								 			<span style="font-weight: bold;">${fda.forum.title }:</span><br>
								 			<span>${bean.content }</span><br>
								 		</div>
									</div>
									<div style="height:25px;width:757px;float:top;border: 1px solid #508fb6;border-top:none;">
										&nbsp;<a href="#"><img src="/estate/images/p_up.gif"/></a>
									</div>
							</div>
						</td>
					   
					  </tr>
					</table><br>
              	  </div>
              	  </jmesa:htmlColumn>
              </jmesa:htmlRow>
          </jmesa:htmlTable>
      </jmesa:struts2TableModel>
      </div>
</div>

  </form>


<!-- 下为评论 -->

<form  id="form3"  name="form3" action="" method="post">
<a name="commentDiv"></a>
<div id="comment" style="display: none;">
<table width="80%" align="center" border="0" cellspacing="0" cellpadding="0" class="main">
<input type="hidden" id="replyId" name="replyId"/>
<input type="hidden" id="forumId" name="forumId"/>
  <tr align="center">
    <td colspan="4" class="tableTitle">回复帖子</td>
  </tr>
  <tr>
    <td width="10%" align="right" class="two" >标题：</td>
    <td width="90%" class="two" align="left"><input name="title" readonly="readonly" id="commentTitle" type="text" class="input" style="width: 400px"></td>
  </tr>
  
  <tr style="height:360px" >
    <td width="10%" align="right" class="two">内容：</td>
    <td width="90%" class="two" align="left">
    	
		<textarea class="ckeditor" cols="80" id="commentContent" name="content" rows="10"></textarea>
    </td>
  </tr>
  <tr>
  	<td colspan="2" class="two" align="center">
  		<input type="button" name="Submit2" onFocus="this.blur();" value="评论" class="button2" onclick="comment(form3)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  		<input type="reset" name="Submit3" onFocus="this.blur();" value="重置" class="button2"> 
  	</td>
  </tr>
 
  <tr><td class="two" colspan="2">&nbsp;</td></tr>
</table><br>
</div>
</form>
</body>
<script type="text/javascript">
      function onInvokeAction(id){
          $.jmesa.setExportToLimit(id,'');
          $.jmesa.createHiddenInputFieldsForLimitAndSubmit(id);
      }  
      function onInvokeExportAction(id) {
			var parameterString = $.jmesa.createParameterStringForLimit(id);
			location.href = "testAction.action?method=export&" + parameterString;
      }
  </script>
</html>
